package com.lkdont.android.base.util

import android.content.Context
import android.content.pm.PackageManager
import androidx.core.content.ContextCompat

/**
 * 权限工具
 *
 * @author lqd
 */
class PermissionUtils {

    companion object {

        /**
         * 检查是否拥有[permissions]列表中的所有权限
         */
        fun hasPermissions(context: Context, permissions: Array<String>) = permissions.all {
            ContextCompat.checkSelfPermission(context, it) == PackageManager.PERMISSION_GRANTED
        }

    }

}